//
//  myCardTableViewCell.m
//  LeZhuanWorker
//
//  Created by 于跃隆 on 2020/4/13.
//  Copyright © 2020 xiaohao. All rights reserved.
//

#import "myCardTableViewCell.h"

@implementation myCardTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        //设置颜色
        self.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0];
        
//        [self mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.right.mas_equalTo(kSCRATIO(0));
//            make.height.mas_equalTo(KSCHEIGHT(40));
//        }];
//        
        //添加控件s约束
        [self setContrFrame];
    }
    return self;
}
- (void)setFrame:(CGRect)frame{
    frame.origin.x += 0;
    frame.origin.y += 0;
    frame.size.height -= KSCHEIGHT(10);
    frame.size.width -= 0;
    [super setFrame:frame];
}
-(void)setContrFrame{
    [self addSubview:self.mycardImageV];
    [self addSubview:self.myCardLabel];
    [self addSubview:self.myCardNumberLabel];
    
    [_mycardImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.left.mas_equalTo(kSCRATIO(15));
        make.width.height.mas_equalTo(kSCRATIO(25));
    }];
    [_myCardLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.left.mas_equalTo(_mycardImageV.mas_right).mas_equalTo(kSCRATIO(10));
        make.height.mas_equalTo(KSCHEIGHT(15));
        
    }];
    [_myCardNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.left.mas_equalTo(_myCardLabel.mas_right).mas_equalTo(kSCRATIO(10));
        make.right.mas_equalTo(kSCRATIO(-20));
        
        make.height.mas_equalTo(KSCHEIGHT(12));
        
    }];
    
    
}
-(UIImageView *)mycardImageV{
    if (!_mycardImageV) {
        _mycardImageV = [[UIImageView alloc] init];
        _mycardImageV.image = [UIImage imageNamed:@"工商银行"];
        
    }
    return _mycardImageV;
}
-(UILabel *)myCardLabel{
    if (!_myCardLabel) {
        _myCardLabel = [[UILabel alloc] init];
        _myCardLabel.text = @"农业银行";
        _myCardLabel.numberOfLines = 0;
        _myCardLabel.font = kFONT(kSCRATIO(15));
        _myCardLabel.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
        
    }
    return _myCardLabel;
}
-(UILabel *)myCardNumberLabel{
    if (!_myCardNumberLabel) {
        _myCardNumberLabel = [[UILabel alloc] init];
        _myCardNumberLabel.text = @"6666    6666    6666    666    6666";
        _myCardNumberLabel.numberOfLines = 0;
        _myCardNumberLabel.font = kFONT(kSCRATIO(15));
        _myCardNumberLabel.textColor = [UIColor colorWithRed:248/255.0 green:80/255.0 blue:92/255.0 alpha:1.0];
        
    }
    return _myCardNumberLabel;
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
